package test_instanceof;

public class Main {
    public static void main(String[] args) {
        Student student = new Student();

        boolean result = student instanceof Person;

        Person person1 = new Student();
        Person person2 = new Teacher();
        System.out.println("person1的结果： "  );
        System.out.println(person1 instanceof Student);
        System.out.println("person2的结果： "  );
        System.out.println(person2 instanceof Student);

        if (person1 instanceof Student){
            Student student1 = (Student) person1;
            student1.test();
            person1.test();
        }
        if (person2 instanceof Teacher){
            Teacher teacher = (Teacher) person2;
            teacher.test();
        }

    }
}
